Skip to content

[Test Improver] test(shared): add 34 unit tests for CriteriaStore - #399

Open
Cedric Vidal (cedricvidal) wants to merge 1 commit into
mainfrom
test-assist/criteria-store-unit-tests-50dd0f8f40845112
Open

Cedric Vidal (cedricvidal) wants to merge 1 commit into
mainfrom
test-assist/criteria-store-unit-tests-50dd0f8f40845112

Conversation

@cedricvidal

Copy link
Copy Markdown
Collaborator

Original author: Cedric Vidal (@cedricvidal)

Tests cover all public methods using an in-memory mock MongoDB collection (same pattern as task-prompt-store.test.ts):

  • getAll: empty, sorted, excludes soft-deleted
  • get: not found, by id, soft-deleted returns null
  • create: happy path, trim prompt, dependencies, invalid id format, duplicate id, nonexistent dep, cycle detection
  • update: prompt, trim, dependencies, not found, bad dep
  • delete: soft-delete, not found, blocks if dependents exist, allows when dependent is soft-deleted
  • resolveWithAncestors: single, transitive, diamond dedup, not found error, multiple starting criteria
  • getGraph: empty, nodes+edges, excludes soft-deleted
  • seed: insert new, skip existing, returns count

Tests cover all public methods using an in-memory mock MongoDB
collection (same pattern as task-prompt-store.test.ts):

- getAll: empty, sorted, excludes soft-deleted
- get: not found, by id, soft-deleted returns null
- create: happy path, trim prompt, dependencies, invalid id
  format, duplicate id, nonexistent dep, cycle detection
- update: prompt, trim, dependencies, not found, bad dep
- delete: soft-delete, not found, blocks if dependents exist,
  allows when dependent is soft-deleted
- resolveWithAncestors: single, transitive, diamond dedup,
  not found error, multiple starting criteria
- getGraph: empty, nodes+edges, excludes soft-deleted
- seed: insert new, skip existing, returns count

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cedricvidal

Copy link
Copy Markdown
Collaborator Author

Original author: @github-actions[bot]

Test Results (Node.js 22)

test: Run #346

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
716 716 0 0 0 0 0 21.5s

🎉 All tests passed!

Github Test Reporter

@manekinekko Wassim Chegham (manekinekko) added language: javascript Work involving JavaScript code, tooling, or dependencies. topic: testing Test coverage, test infrastructure, and validation quality. agentic-workflows gh aw driven workflows that automate repository tasks. DOT NOT RENAME. type: automation Changes that automate recurring tasks or workflows. area: shared Shared package: types, DB models, and queue/blob/redis clients used by all apps. and removed author: cedricvidal labels Sep 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflows gh aw driven workflows that automate repository tasks. DOT NOT RENAME. area: shared Shared package: types, DB models, and queue/blob/redis clients used by all apps. language: javascript Work involving JavaScript code, tooling, or dependencies. topic: testing Test coverage, test infrastructure, and validation quality. type: automation Changes that automate recurring tasks or workflows.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants